<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>XProject</title>
	<script src="jquery/jquery-1.5.2.min.js" type="text/javascript"></script>
	
	<style type="text/css">
	<!--
	body { font-family: arial,sans-serif; background-color: #fff; margin-top: 2; }
	td {font-family: arial, sans-serif;}
	
	.gaia.le.lbl { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
	  
	#login-form {overflow:hidden;}
	#login-form table {margin-top:5em; padding:1em; margin-left: auto; margin-right: auto; border: 2px solid #1A88DE; background-color:#E0ECFF; }
	#login-form table td {padding: 6px;}
	#login-form label {font-weight: bold;}
	#login-form input#loginName, #login-form input#password { width: 200px; }
	
	.footer {
	  color: #666;
	  font-size: smaller;
	  margin-top: 40px;
	  text-align: center;
	  vertical-align:middle;
	}
	
	.error{
		background:url('images/error.gif') no-repeat 10px 10px;
		color: #F00;
		border: 2px solid #F00;
		margin-top: 4px;
	}
	--></style>
	
	<script language='javascript'>
		$(function(){
			setFocusOnName();
		});
		
		function loginSubmit() {
			 var loginName = $("#loginName").val();
			 var password = $("#password").val();
			 if(loginName.length<=0){
	            $("#loginName").focus();
	         }else if(password.length <= 0){
	             $("#password").focus();
	         }else{
		         jQuery.ajax({
				 	type: "POST",
					url:"loginSubmit.action",
					data: "loginName=" +loginName+ "&password=" +password,
		            dataType: "text",
					 context: document.body, success: function(html){
			    		$("#password").val('');
					 	if(html.length <= 0){
						 	$('#errorInfo').html('成功');
			    			$('#errorInfo').hide();
							window.moveTo( 0, 0 );
							window.resizeTo(screen.availWidth, screen.availHeight);
			    			document.location.replace("main.action");
		    			}else{
						 	$('#errorInfo').html(html);
			    			$('#errorInfo').show();
			    			$('#password').focus();
		    			}
		    		},error : function(){
					 	$('#errorInfo').html('登录失败');
		    		}
				});
			}
			return false;
		}
		
	</script>
</head>

<body>
	<div style="background: #E7EFFF 0 0 repeat-x;">
		<img src="images/logo.gif">
	</div>

	<div id="login-form">
		<div id="errorInfo" style="padding: 8px 25px;"></div>
	
		<form id="xp_loginform" action="" onsubmit="return loginSubmit()" method="post">
		  <table id="gaia_table" align="center" border="0" cellpadding="1" cellspacing="0">
			<tr>
				<td colspan="2" align="center">
					<div>
						<label>XProject帐户</label>
					</div>
				</td>
			</tr>
			<tr>
			  <td colspan="2" align="center">
			  </td>
			</tr>
			<tr>
			  <td nowrap="nowrap" align="right">
			  	<span class="gaia le lbl">登录名:</span>
			  </td>
			  <td>
			  	<input type="text" name="loginName" id="loginName" size="30" value="" class='gaia le lbl' />
			  </td>
			</tr>
			
			<tr id="password-row" class="enabled">
			  <td align="right">
				  <span class="gaia le lbl"> 密码: </span>
			  </td>
			  <td>
			  	<input type="password" name="password" id="password" size="20" class="gaia le lbl" />
			  </td>
			</tr>
			
			<tr>
			  <td></td>
			  <td align="left">
			  	<input type="submit" class="gaia le button" name="signIn" id="signIn" value="登录" />
			  </td>
			</tr>
		  </table>
		</form>
	</div>

	<script><!--
	var xp_loginform;
	if (document.getElementById) {
	  xp_loginform = document.getElementById("xp_loginform");
	} else if (window.xp_loginform) {
	  xp_loginform = window.xp_loginform;
	}
	
	var gaia_loginNameHasKeypress = false;
	if (xp_loginform && xp_loginform.loginName) {
	  xp_loginform.loginName.onkeypress = function() {
	    gaia_loginNameHasKeypress = true;
	  }
	}
	
	function setFocusOnName() {
		<#if message??>
			$('#errorInfo').html('${message}');
			$('#errorInfo').show();
		<#else>
			$('#errorInfo').hide();
		</#if>
		$('#errorInfo').addClass('error');
		if (xp_loginform) {
			if (xp_loginform.loginName && !xp_loginform.loginName.value) {
				xp_loginform.loginName.focus();
			} else if (xp_loginform.password && !gaia_loginNameHasKeypress) {
				xp_loginform.password.focus();
			}
		}
	}
	
	--></script>

<div class="footer">
  2011&copy; openstudy
</div>

</body>
</html>
